<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006-2016 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: 流年 <liu21st@gmail.com>
// +----------------------------------------------------------------------

// 应用公共文件

# 根据用户的主键id，查询用户的名称
if ( ! function_exists('getUserName')){
    function getUserName($id){
        return \think\Db::name('user')->where('id', $id)->value('name');
    }
}
# 过滤一下文章摘要
function getArtContent($content){
    return mb_substr(strip_tags($content), 0, 20).' [详情]';
}

if ( ! function_exists('getCateName')){
    function getCateName($id){
        return \think\Db::name('article_category')->where('id', $id)->value('name');
    }
}

